{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Dialog/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport { DialogInput, Name, UserStatus } from \"../\";\nimport { Context } from \"../../index\";\nimport { Messages } from \"../../containers\";\nimport { observer } from \"mobx-react-lite\";\nimport { getOtherUserForNotMultiChat } from \"../../utils/Membership\";\nimport './Dialog.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Dialog = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [chatId, setChatId] = React.useState(null);\n  const [otherUser, setOtherUser] = React.useState();\n  React.useEffect(() => {\n    if (store.viewedDialogId) {\n      setChatId(store.viewedDialogId);\n    }\n  }, [store.viewedDialogId]);\n  React.useEffect(() => {\n    if (store.currentDialog && !store.currentDialog.multiChat && store.currentDialog.membership && store.currentDialog.membership.items.length > 0) {\n      setOtherUser(getOtherUserForNotMultiChat(store, store.currentDialog.membership));\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [store.currentDialog]);\n  if (store.getViewedDialogId()) {\n    if (!store.getCurrentDialog().multiChat) {\n      return /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__dialog\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-header\",\n          children: [/*#__PURE__*/_jsxDEV(\"div\", {}, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 39,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"messenger__dialog-header-info\",\n            children: [/*#__PURE__*/_jsxDEV(\"p\", {\n              className: \"messenger__dialog-header-name\",\n              children: /*#__PURE__*/_jsxDEV(Name, {\n                user: otherUser,\n                chatName: store.currentDialog.name,\n                multiChat: store.currentDialog.multiChat\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 42,\n                columnNumber: 33\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 41,\n              columnNumber: 29\n            }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"messenger__dialog-header-status\",\n              children: /*#__PURE__*/_jsxDEV(UserStatus, {\n                status: true\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 45,\n                columnNumber: 33\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 44,\n              columnNumber: 29\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 40,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n            className: \"messenger__dialog-header-more\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 48,\n            columnNumber: 25\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 38,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-messages\",\n          children: /*#__PURE__*/_jsxDEV(Messages, {}, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 51,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 50,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-input\",\n          children: /*#__PURE__*/_jsxDEV(DialogInput, {\n            chatId: chatId && chatId\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 54,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 53,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 37,\n        columnNumber: 17\n      }, this);\n    } else {\n      var _store$currentDialog$, _store$currentDialog$2;\n      return /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__dialog\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-header\",\n          children: [/*#__PURE__*/_jsxDEV(\"div\", {}, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 62,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"messenger__dialog-header-info\",\n            children: [/*#__PURE__*/_jsxDEV(\"p\", {\n              className: \"messenger__dialog-header-name\",\n              children: /*#__PURE__*/_jsxDEV(Name, {\n                user: otherUser,\n                chatName: store.currentDialog.name,\n                multiChat: store.currentDialog.multiChat\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 65,\n                columnNumber: 33\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 64,\n              columnNumber: 29\n            }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"messenger__dialog-header-countMemberships\",\n              children: ((_store$currentDialog$ = store.currentDialog.membership) === null || _store$currentDialog$ === void 0 ? void 0 : _store$currentDialog$.items) && /*#__PURE__*/_jsxDEV(\"span\", {\n                children: `Участников в диалоге: ${Object.keys((_store$currentDialog$2 = store.currentDialog.membership) === null || _store$currentDialog$2 === void 0 ? void 0 : _store$currentDialog$2.items).length}`\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 69,\n                columnNumber: 37\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 67,\n              columnNumber: 29\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 63,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n            className: \"messenger__dialog-header-more\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 75,\n            columnNumber: 25\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 61,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-messages\",\n          children: /*#__PURE__*/_jsxDEV(Messages, {}, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 78,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 77,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-input\",\n          children: /*#__PURE__*/_jsxDEV(DialogInput, {\n            chatId: chatId && chatId\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 81,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 80,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 60,\n        columnNumber: 17\n      }, this);\n    }\n  } else {\n    return /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__dialog\",\n      children: /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__dialog-messages\",\n        children: /*#__PURE__*/_jsxDEV(Messages, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 90,\n          columnNumber: 21\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 89,\n        columnNumber: 17\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 88,\n      columnNumber: 13\n    }, this);\n  }\n};\n_s(Dialog, \"Q7GQ1r9hUhecWFCJn8AW31Qs0BQ=\");\n_c = Dialog;\nexport default _c2 = observer(Dialog);\nvar _c, _c2;\n$RefreshReg$(_c, \"Dialog\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","DialogInput","Name","UserStatus","Context","Messages","observer","getOtherUserForNotMultiChat","Dialog","store","useContext","chatId","setChatId","useState","otherUser","setOtherUser","useEffect","viewedDialogId","currentDialog","multiChat","membership","items","length","getViewedDialogId","getCurrentDialog","name","Object","keys"],"sources":["/data/messenger.client/src/components/Dialog/index.tsx"],"sourcesContent":["import React from 'react';\nimport {DialogInput, Name, UserStatus} from \"../\";\nimport {Context} from \"../../index\";\nimport {Messages} from \"../../containers\";\nimport {observer} from \"mobx-react-lite\";\nimport {UserListItem} from \"../../models/response/UserListItem\";\nimport {getOtherUserForNotMultiChat} from \"../../utils/Membership\";\nimport './Dialog.scss';\nconst Dialog = () => {\n    const {store} = React.useContext(Context);\n    const [chatId, setChatId] = React.useState<number | null>(null);\n    const [otherUser, setOtherUser] = React.useState<UserListItem>();\n\n    React.useEffect(() => {\n        if (store.viewedDialogId!) {\n            setChatId(store.viewedDialogId);\n        }\n    }, [store.viewedDialogId]);\n\n    React.useEffect(() => {\n\n        if (store.currentDialog! &&\n            !store.currentDialog.multiChat &&\n            store.currentDialog.membership &&\n            store.currentDialog.membership.items.length > 0\n        ) {\n            setOtherUser(\n                getOtherUserForNotMultiChat(store, store.currentDialog.membership)\n            );\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [store.currentDialog]);\n\n    if (store.getViewedDialogId()!) {\n        if (!store.getCurrentDialog().multiChat) {\n            return (\n                <div className=\"messenger__dialog\">\n                    <div className=\"messenger__dialog-header\">\n                        <div/>\n                        <div className=\"messenger__dialog-header-info\">\n                            <p className=\"messenger__dialog-header-name\">\n                                <Name user={otherUser} chatName={store.currentDialog.name} multiChat={store.currentDialog.multiChat} />\n                            </p>\n                            <div className=\"messenger__dialog-header-status\">\n                                <UserStatus status={true} />\n                            </div>\n                        </div>\n                        <button className=\"messenger__dialog-header-more\" />\n                    </div>\n                    <div className=\"messenger__dialog-messages\">\n                        <Messages />\n                    </div>\n                    <div className=\"messenger__dialog-input\">\n                        <DialogInput chatId={chatId! && chatId} />\n                    </div>\n                </div>\n            );\n        } else {\n            return (\n                <div className=\"messenger__dialog\">\n                    <div className=\"messenger__dialog-header\">\n                        <div/>\n                        <div className=\"messenger__dialog-header-info\">\n                            <p className=\"messenger__dialog-header-name\">\n                                <Name user={otherUser} chatName={store.currentDialog.name} multiChat={store.currentDialog.multiChat} />\n                            </p>\n                            <div className=\"messenger__dialog-header-countMemberships\">\n                                {store.currentDialog.membership?.items &&\n                                    <span>\n                                        {`Участников в диалоге: ${Object.keys(store.currentDialog.membership?.items).length}`}\n                                    </span>\n                                }\n                            </div>\n                        </div>\n                        <button className=\"messenger__dialog-header-more\" />\n                    </div>\n                    <div className=\"messenger__dialog-messages\">\n                        <Messages />\n                    </div>\n                    <div className=\"messenger__dialog-input\">\n                        <DialogInput chatId={chatId! && chatId} />\n                    </div>\n                </div>\n            );\n        }\n    } else {\n        return (\n            <div className=\"messenger__dialog\">\n                <div className=\"messenger__dialog-messages\">\n                    <Messages />\n                </div>\n            </div>\n        );\n    }\n}\n\nexport default observer(Dialog);"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,WAAW,EAAEC,IAAI,EAAEC,UAAU,QAAO,KAAK;AACjD,SAAQC,OAAO,QAAO,aAAa;AACnC,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,SAAQC,QAAQ,QAAO,iBAAiB;AAExC,SAAQC,2BAA2B,QAAO,wBAAwB;AAClE,OAAO,eAAe;AAAC;AACvB,MAAMC,MAAM,GAAG,MAAM;EAAA;EACjB,MAAM;IAACC;EAAK,CAAC,GAAGT,KAAK,CAACU,UAAU,CAACN,OAAO,CAAC;EACzC,MAAM,CAACO,MAAM,EAAEC,SAAS,CAAC,GAAGZ,KAAK,CAACa,QAAQ,CAAgB,IAAI,CAAC;EAC/D,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGf,KAAK,CAACa,QAAQ,EAAgB;EAEhEb,KAAK,CAACgB,SAAS,CAAC,MAAM;IAClB,IAAIP,KAAK,CAACQ,cAAc,EAAG;MACvBL,SAAS,CAACH,KAAK,CAACQ,cAAc,CAAC;IACnC;EACJ,CAAC,EAAE,CAACR,KAAK,CAACQ,cAAc,CAAC,CAAC;EAE1BjB,KAAK,CAACgB,SAAS,CAAC,MAAM;IAElB,IAAIP,KAAK,CAACS,aAAa,IACnB,CAACT,KAAK,CAACS,aAAa,CAACC,SAAS,IAC9BV,KAAK,CAACS,aAAa,CAACE,UAAU,IAC9BX,KAAK,CAACS,aAA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